home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / pvm34b3.zip / pvm34b3 / pvm3 / tracer / trclib.h < prev    next >
C/C++ Source or Header  |  1997-07-22  |  5KB  |  242 lines

  1.  
  2. /* $Id: trclib.h,v 4.5 1997/06/25 21:45:46 pvmsrc Exp $ */
  3.  
  4. /*
  5.  *         Tracer version 1.0:  A Trace File Generator for PVM
  6.  *           Oak Ridge National Laboratory, Oak Ridge TN.
  7.  *           Authors:  James Arthur Kohl and G. A. Geist
  8.  *                   (C) 1994 All Rights Reserved
  9.  *
  10.  *                              NOTICE
  11.  *
  12.  * Permission to use, copy, modify, and distribute this software and
  13.  * its documentation for any purpose and without fee is hereby granted
  14.  * provided that the above copyright notice appear in all copies and
  15.  * that both the copyright notice and this permission notice appear
  16.  * in supporting documentation.
  17.  *
  18.  * Neither the Institution, Oak Ridge National Laboratory, nor the
  19.  * Authors make any representations about the suitability of this
  20.  * software for any purpose.  This software is provided ``as is''
  21.  * without express or implied warranty.
  22.  *
  23.  * Tracer was funded by the U.S. Department of Energy.
  24.  */
  25.  
  26.  
  27. /* System Header Files */
  28.  
  29. #include <stdio.h>
  30. #include <sys/types.h>
  31. #ifndef WIN32
  32. #include <sys/time.h>
  33. #else
  34. #include "pvmwin.h"
  35. #endif
  36. #include <time.h>
  37. #include <malloc.h>
  38.  
  39.  
  40. /* PVM Header File */
  41.  
  42. #include <pvm3.h>
  43.  
  44.  
  45. /* PVM Trace Header File */
  46.  
  47. #ifdef USE_PVM_33
  48.  
  49. /* Backwards Compatibility Header for PVM 3.3 Usage */
  50.  
  51. #include "trccompatrev.h"
  52.  
  53. #else
  54.  
  55. #include <pvmtev.h>
  56.  
  57. #endif
  58.  
  59.  
  60. /* Tracer Data Type Header */
  61.  
  62. #include "trctype.h"
  63.  
  64.  
  65. /* Define Maximum Trace Message Unpacking Array Size */
  66.  
  67. #define TRC_MAX_UNPACK_ARR_SIZE    1024
  68.  
  69.  
  70. /* PVM Error Check Macro */
  71.  
  72. #define TRC_NOP    (TRC_TMP_CC = TRC_TMP_CC)
  73.  
  74.  
  75. #define TRC_PVMCKERR( _cmd, _str, _handle ) \
  76. { \
  77.     TRC_TMP_CC = _cmd; \
  78. \
  79.     if ( TRC_TMP_CC < 0 ) \
  80.     { \
  81.         pvm_perror( _str ); \
  82. \
  83.         _handle; \
  84.     } \
  85. } \
  86. \
  87.  
  88.  
  89. /* Trace File EOF Check Macro */
  90.  
  91. #define TRC_CKEOF( _c, _str, _handle ) \
  92. { \
  93.     if ( _c == (char) EOF ) \
  94.     { \
  95.         printf( _str ); \
  96. \
  97.         _handle; \
  98.     } \
  99. } \
  100. \
  101.  
  102.  
  103. /* Time Value Macros */
  104.  
  105. #define TRC_TIME_COMPARE( _t1, _t2 ) \
  106. ( \
  107.     ( (_t1).tv_sec > (_t2).tv_sec \
  108.             || ( (_t1).tv_sec == (_t2).tv_sec \
  109.                 && (_t1).tv_usec > (_t2).tv_usec ) ) ? 1 : \
  110.         ( ( (_t1).tv_sec == (_t2).tv_sec \
  111.             && (_t1).tv_usec == (_t2).tv_usec ) ? 0 : -1 ) \
  112. ) \
  113. \
  114.  
  115. #define TRC_TIME_ELAPSED( _t1, _t2 ) \
  116. ( \
  117.     ( ( (_t2).tv_sec - (_t1).tv_sec ) * 1000000 ) \
  118.         + ( (_t2).tv_usec - (_t1).tv_usec ) \
  119. ) \
  120. \
  121.  
  122.  
  123. /* Task Status Constants */
  124.  
  125. #define TRC_TASK_NOLIFE     0
  126. #define TRC_TASK_ALIVE      1
  127. #define TRC_TASK_DEAD       2
  128. #define TRC_TASK_IGNORE     3
  129. #define TRC_TASK_WAITEND    4
  130.  
  131.  
  132. /* Task Output Status Constants */
  133.  
  134. #define TRC_TASK_NOOUT      0
  135. #define TRC_TASK_OUT        1
  136. #define TRC_TASK_EOF        2
  137. #define TRC_TASK_WAITEOF    3
  138.  
  139.  
  140. /* Task Omission Condition Macro */
  141.  
  142. #define TRC_TASK_OMIT( _tevtask ) \
  143.     ( (_tevtask)->tevstatus == TRC_TASK_WAITEND \
  144.         || (_tevtask)->outstatus == TRC_TASK_WAITEOF )
  145.  
  146.  
  147. /* TRC_TRIE Size */
  148.  
  149. #define TRC_TRIE_SIZE 37
  150.  
  151.  
  152. /* Trace Event Descriptor Index Lookup Macro */
  153.  
  154. #define TRC_TEVINDEX_OF( _eid, _entry_exit ) \
  155.     ( ( (_eid) * TRC_MAX_TEV ) + (_entry_exit) )
  156.  
  157.  
  158. #define TRC_TEVEID_OF( _index ) \
  159.     ( (_index) / TRC_MAX_TEV )
  160.  
  161.  
  162. /* Internal Trace Event Constants */
  163.  
  164. #define TRC_RESERVED_INTERNAL    0x0190  /* ((400+n) * 2) + 1 < 1000 */
  165.  
  166.  
  167. #define TRC_HOST_ADD        (TRC_RESERVED_INTERNAL + 1)
  168. #define TRC_HOST_DEL        (TRC_RESERVED_INTERNAL + 2)
  169. #define TRC_HOST_SYNC        (TRC_RESERVED_INTERNAL + 3)
  170. #define TRC_OUTPUT            (TRC_RESERVED_INTERNAL + 4)
  171. #define TRC_MAX                (TRC_RESERVED_INTERNAL + 5)
  172.  
  173.  
  174. /* Externals */
  175.  
  176. #ifndef USE_PVM_33
  177.  
  178. extern  struct Pvmtevdid    pvmtevdidlist[];
  179.  
  180. #endif
  181.  
  182.  
  183. /* Routine Prototypes */
  184.  
  185. #include "trcproto.h"
  186.  
  187.  
  188. /* Global Variables */
  189.  
  190. extern    struct timeval    TRC_TRACE_TIME;
  191.  
  192. extern    TRC_TEVDESC        TRC_OUTPUT_TEVDESC;
  193. extern    TRC_TEVDESC        TRC_HOST_ADD_TEVDESC;
  194. extern    TRC_TEVDESC        TRC_HOST_DEL_TEVDESC;
  195. extern    TRC_TEVDESC        TRC_HOST_SYNC_TEVDESC;
  196.  
  197. extern    TRC_TEVDESC        *TRC_TEVDESC_LIST;
  198.  
  199. extern    int                TRC_TEVDESC_SIZE;
  200.  
  201. extern    TRC_TEVREC        TRC_TMP_TR;
  202.  
  203. extern    TRC_TRIE        TRC_OLD_EVENT_TRIE;
  204.  
  205. extern    TRC_TRIE        TRC_HANDLE_TRIE;
  206.  
  207. extern    TRC_TRIE        TRC_EVENT_TRIE;
  208.  
  209. extern    TRC_TRIE        TRC_DID_TRIE;
  210.  
  211. extern    TRC_DID            TRC_LOCAL_DID[TEV_DID_MAX - TEV_DID_FIRST + 1];
  212.  
  213. extern    TRC_DID            TRC_DID_LIST;
  214.  
  215. extern    TRC_ID            TRC_DEAD_ID_LIST;
  216.  
  217. extern    TRC_ID            TRC_ID_LIST;
  218.  
  219. extern    char            *TRC_TYPE_STRS[16];
  220.  
  221. extern    char            *TRC_VERSION;
  222.  
  223. extern    char            *TRC_NAME;
  224.  
  225. extern    char            *TRC_TMP_HOST;
  226.  
  227. extern    TRC_HOST        TRC_HOST_LIST;
  228.  
  229. extern    char            *TRC_HOST_NAME;
  230.  
  231. extern    char            *TRC_HOST_ALIAS;
  232.  
  233. extern    int                TRC_HOST_ADD_NOTIFY_CODE;
  234. extern    int                TRC_HOST_DEL_NOTIFY_CODE;
  235.  
  236. extern    int                TRC_TID;
  237.  
  238. extern    int                TRC_TMP_CMP;
  239.  
  240. extern    int                TRC_TMP_CC;
  241.  
  242.